package compositeExpression_Fact;

import visitor.Visitor;
import compositeExpression.Expression;
import compositeExpression.Fact;
import exceptions.IllegalContextException;

public class FactNum extends Fact{
	
	private String val;
    private int num;
    
    public FactNum(String val) {

        this.val = val;
    }
    
    public int getState() {

        return num;
    }

	@Override
	public void toAssess(String p) throws IllegalContextException {
		 num = Integer.parseInt(val);
		
	}

	@Override
    public void accept(Visitor v) {
        v.visit(this);
    }
	
	
	@Override
	public void add(Expression termb) {
		throw new IllegalStateException("istruzione non supportata");
	}
	

    @Override
    public String toString() {

        StringBuilder sb = new StringBuilder();

        return sb.append(num).toString();
    }


}
